import java.io.*;

public class IODemo5 {
    public static void main(String[] args) throws IOException {
        try(Reader reader=new FileReader("./test.txt")){
            while(true){
                char[] buffer=new char[1024];
                int n=reader.read(buffer);
                if(n==-1){
                    break;
                }
//                String s=new String(buffer,0,n);
//                System.out.println(s);
                for(int i=0;i<n;i++){
                    System.out.print(buffer[i]+" ");
                }
            }
        }

        try(Writer writer=new FileWriter("./test.txt",true)){
            String s="坤坤";
            writer.write(s);
        }
    }
}
